/**
 * 
 */
package com.somobile.json.converters;

import java.lang.reflect.Type;
import java.util.Date;

import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;

/**
 * @author Jatan
 * 
 */
public class DateTimeDeserializer implements JsonDeserializer<Date>
{

	private static final DateTimeDeserializer _instance = new DateTimeDeserializer();

	private DateTimeDeserializer()
	{

	}

	public static DateTimeDeserializer getInstance()
	{
		return _instance;
	}

	@Override
	public Date deserialize(JsonElement json, Type type,
			JsonDeserializationContext jsondc) throws JsonParseException
	{
		return new Date((json.getAsLong() * 1000));
	}

}
